/**
 * 设备添加日志管理初始化
 */
var OpertationLog = {
    id: "OpertationLogTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
OpertationLog.initColumn = function () {
    return [[
        {title: '商户名称', field: 'merchantName', align: 'center'},
        {title: '操作人', field: 'userName', align: 'center'},
        {title: '设备数量', field: 'operationContent', align: 'center'},
        {title: '操作类型', field: 'type', align: 'center',templet:function (res) {
                return "添加设备";
            }},
        {title: '操作时间', field: 'createTime', align: 'center'}
    ]];
};

OpertationLog.tableList = function () {
    layui.use("table", function () {
        var table = layui.table;

        table.render({
            elem: "#table",
            url: Feng.ctxPath + "/opertationLog/list",
            cellMinWidth: 120,
            where: null,
            page: true,
            limit: 20,
            cols: OpertationLog.initColumn(),
            parseData: function (res) {
                return {
                    "code": 0,
                    "msg": "成功",
                    "count": res.total,
                    "data": res.items
                }
            },
            text: {
                none: '暂无相关数据'
            },
            id: "tableReload"
        });
    });
};

OpertationLog.exportExcl = function () {
    var hrefUrl =
        Feng.ctxPath + "/opertationLog/export";
    window.location.href = hrefUrl;
};

$(function () {
    OpertationLog.tableList();
});
